<?php

/**
 * @author guoxiaoyong
 *
 */
namespace backend\controllers;

use bc\controller\BackendController;
use bc\model\VendorCooperateformModel;
use bc\util\backend\Page;



class VendorController extends BackendController
{

	public function actionIndex()
	{
		$model = new VendorCooperateformModel();
		$params = '1 = 1 ';
		$page = $this->get('page', 1);
		$list = $model->getList($params, $page, self::PAGE_SIZE);
		$total = $model->getTotal($params);
		$pagination = new Page($total, self::PAGE_SIZE);

		$view['list'] = $list;
		$view['pagination'] = $pagination;
		return $this->render('index', $view);
	}

	public function actionEdit()
	{
		$id = $this->get('id');

		if(!$id)
			$this->redirect('/');
		$model = new VendorCooperateformModel();
		$row = $model->getRowById($id);

		if(!$row)
			$this->redirect('/');

		$view['row'] = $row;

		return $this->render('edit', $view);
	}

}

